{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: langchain_qdrant in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (0.2.0)\n",
      "Requirement already satisfied: langchain-core!=0.3.0,!=0.3.1,!=0.3.10,!=0.3.11,!=0.3.12,!=0.3.13,!=0.3.14,!=0.3.2,!=0.3.3,!=0.3.4,!=0.3.5,!=0.3.6,!=0.3.7,!=0.3.8,!=0.3.9,<0.4.0,>=0.2.43 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from langchain_qdrant) (0.3.21)\n",
      "Requirement already satisfied: pydantic<3.0.0,>=2.7.4 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from langchain_qdrant) (2.8.2)\n",
      "Requirement already satisfied: qdrant-client<2.0.0,>=1.10.1 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from langchain_qdrant) (1.12.2)\n",
      "Requirement already satisfied: PyYAML>=5.3 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from langchain-core!=0.3.0,!=0.3.1,!=0.3.10,!=0.3.11,!=0.3.12,!=0.3.13,!=0.3.14,!=0.3.2,!=0.3.3,!=0.3.4,!=0.3.5,!=0.3.6,!=0.3.7,!=0.3.8,!=0.3.9,<0.4.0,>=0.2.43->langchain_qdrant) (6.0.1)\n",
      "Requirement already satisfied: jsonpatch<2.0,>=1.33 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from langchain-core!=0.3.0,!=0.3.1,!=0.3.10,!=0.3.11,!=0.3.12,!=0.3.13,!=0.3.14,!=0.3.2,!=0.3.3,!=0.3.4,!=0.3.5,!=0.3.6,!=0.3.7,!=0.3.8,!=0.3.9,<0.4.0,>=0.2.43->langchain_qdrant) (1.33)\n",
      "Requirement already satisfied: langsmith<0.2.0,>=0.1.125 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from langchain-core!=0.3.0,!=0.3.1,!=0.3.10,!=0.3.11,!=0.3.12,!=0.3.13,!=0.3.14,!=0.3.2,!=0.3.3,!=0.3.4,!=0.3.5,!=0.3.6,!=0.3.7,!=0.3.8,!=0.3.9,<0.4.0,>=0.2.43->langchain_qdrant) (0.1.133)\n",
      "Requirement already satisfied: packaging<25,>=23.2 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from langchain-core!=0.3.0,!=0.3.1,!=0.3.10,!=0.3.11,!=0.3.12,!=0.3.13,!=0.3.14,!=0.3.2,!=0.3.3,!=0.3.4,!=0.3.5,!=0.3.6,!=0.3.7,!=0.3.8,!=0.3.9,<0.4.0,>=0.2.43->langchain_qdrant) (24.1)\n",
      "Requirement already satisfied: tenacity!=8.4.0,<10.0.0,>=8.1.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from langchain-core!=0.3.0,!=0.3.1,!=0.3.10,!=0.3.11,!=0.3.12,!=0.3.13,!=0.3.14,!=0.3.2,!=0.3.3,!=0.3.4,!=0.3.5,!=0.3.6,!=0.3.7,!=0.3.8,!=0.3.9,<0.4.0,>=0.2.43->langchain_qdrant) (8.5.0)\n",
      "Requirement already satisfied: typing-extensions>=4.7 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from langchain-core!=0.3.0,!=0.3.1,!=0.3.10,!=0.3.11,!=0.3.12,!=0.3.13,!=0.3.14,!=0.3.2,!=0.3.3,!=0.3.4,!=0.3.5,!=0.3.6,!=0.3.7,!=0.3.8,!=0.3.9,<0.4.0,>=0.2.43->langchain_qdrant) (4.12.2)\n",
      "Requirement already satisfied: annotated-types>=0.4.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from pydantic<3.0.0,>=2.7.4->langchain_qdrant) (0.7.0)\n",
      "Requirement already satisfied: pydantic-core==2.20.1 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from pydantic<3.0.0,>=2.7.4->langchain_qdrant) (2.20.1)\n",
      "Requirement already satisfied: grpcio>=1.41.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (1.66.2)\n",
      "Requirement already satisfied: grpcio-tools>=1.41.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (1.62.3)\n",
      "Requirement already satisfied: httpx[http2]>=0.20.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (0.28.0)\n",
      "Requirement already satisfied: numpy>=1.21 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (1.26.4)\n",
      "Requirement already satisfied: portalocker<3.0.0,>=2.7.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (2.10.1)\n",
      "Requirement already satisfied: urllib3<3,>=1.26.14 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (1.26.16)\n",
      "Requirement already satisfied: protobuf<5.0dev,>=4.21.6 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from grpcio-tools>=1.41.0->qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (4.25.5)\n",
      "Requirement already satisfied: setuptools in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from grpcio-tools>=1.41.0->qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (67.8.0)\n",
      "Requirement already satisfied: anyio in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from httpx[http2]>=0.20.0->qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (4.4.0)\n",
      "Requirement already satisfied: certifi in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from httpx[http2]>=0.20.0->qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (2024.7.4)\n",
      "Requirement already satisfied: httpcore==1.* in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from httpx[http2]>=0.20.0->qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (1.0.5)\n",
      "Requirement already satisfied: idna in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from httpx[http2]>=0.20.0->qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (3.4)\n",
      "Requirement already satisfied: h2<5,>=3 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from httpx[http2]>=0.20.0->qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (4.1.0)\n",
      "Requirement already satisfied: h11<0.15,>=0.13 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from httpcore==1.*->httpx[http2]>=0.20.0->qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (0.14.0)\n",
      "Requirement already satisfied: jsonpointer>=1.9 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from jsonpatch<2.0,>=1.33->langchain-core!=0.3.0,!=0.3.1,!=0.3.10,!=0.3.11,!=0.3.12,!=0.3.13,!=0.3.14,!=0.3.2,!=0.3.3,!=0.3.4,!=0.3.5,!=0.3.6,!=0.3.7,!=0.3.8,!=0.3.9,<0.4.0,>=0.2.43->langchain_qdrant) (2.1)\n",
      "Requirement already satisfied: orjson<4.0.0,>=3.9.14 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from langsmith<0.2.0,>=0.1.125->langchain-core!=0.3.0,!=0.3.1,!=0.3.10,!=0.3.11,!=0.3.12,!=0.3.13,!=0.3.14,!=0.3.2,!=0.3.3,!=0.3.4,!=0.3.5,!=0.3.6,!=0.3.7,!=0.3.8,!=0.3.9,<0.4.0,>=0.2.43->langchain_qdrant) (3.10.6)\n",
      "Requirement already satisfied: requests<3,>=2 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from langsmith<0.2.0,>=0.1.125->langchain-core!=0.3.0,!=0.3.1,!=0.3.10,!=0.3.11,!=0.3.12,!=0.3.13,!=0.3.14,!=0.3.2,!=0.3.3,!=0.3.4,!=0.3.5,!=0.3.6,!=0.3.7,!=0.3.8,!=0.3.9,<0.4.0,>=0.2.43->langchain_qdrant) (2.32.3)\n",
      "Requirement already satisfied: requests-toolbelt<2.0.0,>=1.0.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from langsmith<0.2.0,>=0.1.125->langchain-core!=0.3.0,!=0.3.1,!=0.3.10,!=0.3.11,!=0.3.12,!=0.3.13,!=0.3.14,!=0.3.2,!=0.3.3,!=0.3.4,!=0.3.5,!=0.3.6,!=0.3.7,!=0.3.8,!=0.3.9,<0.4.0,>=0.2.43->langchain_qdrant) (1.0.0)\n",
      "Requirement already satisfied: pywin32>=226 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from portalocker<3.0.0,>=2.7.0->qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (305.1)\n",
      "Requirement already satisfied: hyperframe<7,>=6.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from h2<5,>=3->httpx[http2]>=0.20.0->qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (6.0.1)\n",
      "Requirement already satisfied: hpack<5,>=4.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from h2<5,>=3->httpx[http2]>=0.20.0->qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (4.0.0)\n",
      "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from requests<3,>=2->langsmith<0.2.0,>=0.1.125->langchain-core!=0.3.0,!=0.3.1,!=0.3.10,!=0.3.11,!=0.3.12,!=0.3.13,!=0.3.14,!=0.3.2,!=0.3.3,!=0.3.4,!=0.3.5,!=0.3.6,!=0.3.7,!=0.3.8,!=0.3.9,<0.4.0,>=0.2.43->langchain_qdrant) (2.0.4)\n",
      "Requirement already satisfied: sniffio>=1.1 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from anyio->httpx[http2]>=0.20.0->qdrant-client<2.0.0,>=1.10.1->langchain_qdrant) (1.3.1)\n"
     ]
    }
   ],
   "source": [
    "!pip install langchain_qdrant json"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: qdrant-client[fastembed] in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (1.11.3)\n",
      "Collecting fastembed==0.3.6 (from qdrant-client[fastembed])\n",
      "  Downloading fastembed-0.3.6-py3-none-any.whl (55 kB)\n",
      "                                              0.0/55.6 kB ? eta -:--:--\n",
      "     --------------------                   30.7/55.6 kB 435.7 kB/s eta 0:00:01\n",
      "     -------------------------------------- 55.6/55.6 kB 582.1 kB/s eta 0:00:00\n",
      "Requirement already satisfied: grpcio>=1.41.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from qdrant-client[fastembed]) (1.66.2)\n",
      "Requirement already satisfied: grpcio-tools>=1.41.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from qdrant-client[fastembed]) (1.62.3)\n",
      "Requirement already satisfied: httpx[http2]>=0.20.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from qdrant-client[fastembed]) (0.28.0)\n",
      "Requirement already satisfied: numpy>=1.21 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from qdrant-client[fastembed]) (1.26.4)\n",
      "Requirement already satisfied: portalocker<3.0.0,>=2.7.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from qdrant-client[fastembed]) (2.10.1)\n",
      "Requirement already satisfied: pydantic>=1.10.8 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from qdrant-client[fastembed]) (2.8.2)\n",
      "Requirement already satisfied: urllib3<3,>=1.26.14 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from qdrant-client[fastembed]) (1.26.16)\n",
      "Collecting PyStemmer<3.0.0,>=2.2.0 (from fastembed==0.3.6->qdrant-client[fastembed])\n",
      "  Downloading PyStemmer-2.2.0.3-cp311-cp311-win_amd64.whl (184 kB)\n",
      "                                              0.0/184.8 kB ? eta -:--:--\n",
      "     -------------------------------------- 184.8/184.8 kB 5.5 MB/s eta 0:00:00\n",
      "Requirement already satisfied: huggingface-hub<1.0,>=0.20 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from fastembed==0.3.6->qdrant-client[fastembed]) (0.24.5)\n",
      "Collecting loguru<0.8.0,>=0.7.2 (from fastembed==0.3.6->qdrant-client[fastembed])\n",
      "  Downloading loguru-0.7.3-py3-none-any.whl (61 kB)\n",
      "                                              0.0/61.6 kB ? eta -:--:--\n",
      "     ---------------------------------------- 61.6/61.6 kB 3.4 MB/s eta 0:00:00\n",
      "Requirement already satisfied: mmh3<5.0,>=4.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from fastembed==0.3.6->qdrant-client[fastembed]) (4.1.0)\n",
      "Collecting onnx<2.0.0,>=1.15.0 (from fastembed==0.3.6->qdrant-client[fastembed])\n",
      "  Downloading onnx-1.17.0-cp311-cp311-win_amd64.whl (14.5 MB)\n",
      "                                              0.0/14.5 MB ? eta -:--:--\n",
      "                                              0.1/14.5 MB 1.7 MB/s eta 0:00:09\n",
      "                                              0.2/14.5 MB 2.4 MB/s eta 0:00:06\n",
      "     -                                        0.4/14.5 MB 2.9 MB/s eta 0:00:05\n",
      "     -                                        0.4/14.5 MB 2.1 MB/s eta 0:00:07\n",
      "     -                                        0.7/14.5 MB 2.8 MB/s eta 0:00:06\n",
      "     --                                       0.8/14.5 MB 3.0 MB/s eta 0:00:05\n",
      "     --                                       1.0/14.5 MB 3.0 MB/s eta 0:00:05\n",
      "     ---                                      1.2/14.5 MB 3.4 MB/s eta 0:00:04\n",
      "     ---                                      1.3/14.5 MB 3.2 MB/s eta 0:00:05\n",
      "     ----                                     1.5/14.5 MB 3.4 MB/s eta 0:00:04\n",
      "     ----                                     1.5/14.5 MB 3.1 MB/s eta 0:00:05\n",
      "     ----                                     1.5/14.5 MB 3.1 MB/s eta 0:00:05\n",
      "     ----                                     1.5/14.5 MB 2.6 MB/s eta 0:00:05\n",
      "     ----                                     1.5/14.5 MB 2.6 MB/s eta 0:00:05\n",
      "     ----                                     1.5/14.5 MB 2.6 MB/s eta 0:00:05\n",
      "     ----                                     1.6/14.5 MB 2.2 MB/s eta 0:00:06\n",
      "     ----                                     1.6/14.5 MB 2.2 MB/s eta 0:00:06\n",
      "     ----                                     1.6/14.5 MB 2.0 MB/s eta 0:00:07\n",
      "     ----                                     1.6/14.5 MB 2.0 MB/s eta 0:00:07\n",
      "     ----                                     1.8/14.5 MB 1.9 MB/s eta 0:00:07\n",
      "     ----                                     1.8/14.5 MB 1.9 MB/s eta 0:00:07\n",
      "     -----                                    1.9/14.5 MB 1.9 MB/s eta 0:00:07\n",
      "     -----                                    2.1/14.5 MB 2.0 MB/s eta 0:00:07\n",
      "     -----                                    2.2/14.5 MB 1.9 MB/s eta 0:00:07\n",
      "     ------                                   2.3/14.5 MB 2.0 MB/s eta 0:00:07\n",
      "     ------                                   2.4/14.5 MB 2.0 MB/s eta 0:00:07\n",
      "     ------                                   2.5/14.5 MB 2.0 MB/s eta 0:00:07\n",
      "     ------                                   2.5/14.5 MB 2.0 MB/s eta 0:00:07\n",
      "     -------                                  2.5/14.5 MB 1.9 MB/s eta 0:00:07\n",
      "     -------                                  2.6/14.5 MB 1.9 MB/s eta 0:00:07\n",
      "     -------                                  2.6/14.5 MB 1.8 MB/s eta 0:00:07\n",
      "     -------                                  2.7/14.5 MB 1.8 MB/s eta 0:00:07\n",
      "     -------                                  2.7/14.5 MB 1.8 MB/s eta 0:00:07\n",
      "     -------                                  2.8/14.5 MB 1.8 MB/s eta 0:00:07\n",
      "     -------                                  2.8/14.5 MB 1.7 MB/s eta 0:00:07\n",
      "     -------                                  2.8/14.5 MB 1.7 MB/s eta 0:00:07\n",
      "     -------                                  2.9/14.5 MB 1.7 MB/s eta 0:00:07\n",
      "     --------                                 3.0/14.5 MB 1.7 MB/s eta 0:00:07\n",
      "     --------                                 3.1/14.5 MB 1.7 MB/s eta 0:00:07\n",
      "     --------                                 3.2/14.5 MB 1.7 MB/s eta 0:00:07\n",
      "     --------                                 3.2/14.5 MB 1.7 MB/s eta 0:00:07\n",
      "     --------                                 3.2/14.5 MB 1.7 MB/s eta 0:00:07\n",
      "     --------                                 3.2/14.5 MB 1.7 MB/s eta 0:00:07\n",
      "     --------                                 3.2/14.5 MB 1.7 MB/s eta 0:00:07\n",
      "     ---------                                3.5/14.5 MB 1.7 MB/s eta 0:00:07\n",
      "     ---------                                3.5/14.5 MB 1.7 MB/s eta 0:00:07\n",
      "     ---------                                3.5/14.5 MB 1.7 MB/s eta 0:00:07\n",
      "     ---------                                3.6/14.5 MB 1.6 MB/s eta 0:00:07\n",
      "     ---------                                3.6/14.5 MB 1.6 MB/s eta 0:00:07\n",
      "     ----------                               3.6/14.5 MB 1.6 MB/s eta 0:00:07\n",
      "     ----------                               3.6/14.5 MB 1.6 MB/s eta 0:00:07\n",
      "     ----------                               3.6/14.5 MB 1.6 MB/s eta 0:00:07\n",
      "     ----------                               3.7/14.5 MB 1.5 MB/s eta 0:00:08\n",
      "     ----------                               3.7/14.5 MB 1.5 MB/s eta 0:00:08\n",
      "     ----------                               3.9/14.5 MB 1.5 MB/s eta 0:00:08\n",
      "     ----------                               4.0/14.5 MB 1.5 MB/s eta 0:00:07\n",
      "     -----------                              4.0/14.5 MB 1.5 MB/s eta 0:00:07\n",
      "     -----------                              4.1/14.5 MB 1.5 MB/s eta 0:00:07\n",
      "     -----------                              4.2/14.5 MB 1.5 MB/s eta 0:00:07\n",
      "     -----------                              4.2/14.5 MB 1.5 MB/s eta 0:00:07\n",
      "     -----------                              4.3/14.5 MB 1.5 MB/s eta 0:00:07\n",
      "     -----------                              4.3/14.5 MB 1.5 MB/s eta 0:00:07\n",
      "     -----------                              4.3/14.5 MB 1.5 MB/s eta 0:00:07\n",
      "     -----------                              4.3/14.5 MB 1.5 MB/s eta 0:00:07\n",
      "     ------------                             4.4/14.5 MB 1.4 MB/s eta 0:00:08\n",
      "     ------------                             4.4/14.5 MB 1.4 MB/s eta 0:00:08\n",
      "     ------------                             4.4/14.5 MB 1.4 MB/s eta 0:00:08\n",
      "     ------------                             4.5/14.5 MB 1.4 MB/s eta 0:00:08\n",
      "     ------------                             4.6/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     ------------                             4.6/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     -------------                            4.8/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     -------------                            4.8/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     -------------                            4.8/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     -------------                            4.8/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     -------------                            4.9/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     -------------                            4.9/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     -------------                            5.0/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     -------------                            5.0/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     -------------                            5.1/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     -------------                            5.1/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     --------------                           5.1/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     --------------                           5.2/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     --------------                           5.3/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     --------------                           5.3/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     --------------                           5.3/14.5 MB 1.3 MB/s eta 0:00:07\n",
      "     --------------                           5.4/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     ---------------                          5.5/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     ---------------                          5.6/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     ---------------                          5.6/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     ---------------                          5.7/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     ---------------                          5.8/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     ---------------                          5.8/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     ----------------                         6.0/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     ----------------                         6.1/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     ----------------                         6.1/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     ----------------                         6.1/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     ----------------                         6.2/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     -----------------                        6.2/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     -----------------                        6.3/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     -----------------                        6.3/14.5 MB 1.4 MB/s eta 0:00:07\n",
      "     -----------------                        6.4/14.5 MB 1.4 MB/s eta 0:00:06\n",
      "     -----------------                        6.5/14.5 MB 1.4 MB/s eta 0:00:06\n",
      "     ------------------                       6.5/14.5 MB 1.4 MB/s eta 0:00:06\n",
      "     ------------------                       6.7/14.5 MB 1.4 MB/s eta 0:00:06\n",
      "     ------------------                       6.7/14.5 MB 1.4 MB/s eta 0:00:06\n",
      "     ------------------                       6.7/14.5 MB 1.4 MB/s eta 0:00:06\n",
      "     ------------------                       6.8/14.5 MB 1.4 MB/s eta 0:00:06\n",
      "     ------------------                       6.8/14.5 MB 1.4 MB/s eta 0:00:06\n",
      "     ------------------                       6.9/14.5 MB 1.4 MB/s eta 0:00:06\n",
      "     ------------------                       6.9/14.5 MB 1.4 MB/s eta 0:00:06\n",
      "     -------------------                      6.9/14.5 MB 1.3 MB/s eta 0:00:06\n",
      "     -------------------                      7.0/14.5 MB 1.3 MB/s eta 0:00:06\n",
      "     -------------------                      7.0/14.5 MB 1.3 MB/s eta 0:00:06\n",
      "     -------------------                      7.1/14.5 MB 1.3 MB/s eta 0:00:06\n",
      "     -------------------                      7.1/14.5 MB 1.3 MB/s eta 0:00:06\n",
      "     -------------------                      7.1/14.5 MB 1.3 MB/s eta 0:00:06\n",
      "     -------------------                      7.2/14.5 MB 1.3 MB/s eta 0:00:06\n",
      "     --------------------                     7.3/14.5 MB 1.3 MB/s eta 0:00:06\n",
      "     --------------------                     7.4/14.5 MB 1.3 MB/s eta 0:00:06\n",
      "     --------------------                     7.5/14.5 MB 1.3 MB/s eta 0:00:06\n",
      "     --------------------                     7.5/14.5 MB 1.3 MB/s eta 0:00:06\n",
      "     ---------------------                    7.7/14.5 MB 1.4 MB/s eta 0:00:06\n",
      "     ---------------------                    7.8/14.5 MB 1.4 MB/s eta 0:00:06\n",
      "     ---------------------                    8.0/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     ----------------------                   8.0/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     ----------------------                   8.1/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     ----------------------                   8.2/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     ----------------------                   8.2/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     ----------------------                   8.3/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     ----------------------                   8.3/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     ----------------------                   8.3/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     ----------------------                   8.3/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     -----------------------                  8.4/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     -----------------------                  8.5/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     -----------------------                  8.5/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     -----------------------                  8.6/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     -----------------------                  8.7/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     -----------------------                  8.7/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     ------------------------                 8.8/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     ------------------------                 8.9/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     ------------------------                 8.9/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     ------------------------                 9.0/14.5 MB 1.4 MB/s eta 0:00:05\n",
      "     -------------------------                9.1/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     -------------------------                9.3/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     -------------------------                9.4/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     --------------------------               9.5/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     --------------------------               9.5/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     --------------------------               9.5/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     --------------------------               9.6/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     --------------------------               9.6/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     --------------------------               9.6/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     --------------------------               9.7/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     --------------------------               9.7/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     --------------------------               9.8/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     ---------------------------              9.8/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     ---------------------------              9.9/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     ---------------------------              10.0/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     ---------------------------              10.0/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     ---------------------------              10.0/14.5 MB 1.4 MB/s eta 0:00:04\n",
      "     ---------------------------              10.0/14.5 MB 1.3 MB/s eta 0:00:04\n",
      "     ---------------------------              10.1/14.5 MB 1.3 MB/s eta 0:00:04\n",
      "     ---------------------------              10.2/14.5 MB 1.3 MB/s eta 0:00:04\n",
      "     ----------------------------             10.2/14.5 MB 1.3 MB/s eta 0:00:04\n",
      "     ----------------------------             10.2/14.5 MB 1.3 MB/s eta 0:00:04\n",
      "     ----------------------------             10.3/14.5 MB 1.3 MB/s eta 0:00:04\n",
      "     ----------------------------             10.4/14.5 MB 1.3 MB/s eta 0:00:04\n",
      "     ----------------------------             10.4/14.5 MB 1.3 MB/s eta 0:00:04\n",
      "     ----------------------------             10.5/14.5 MB 1.3 MB/s eta 0:00:04\n",
      "     ----------------------------             10.5/14.5 MB 1.3 MB/s eta 0:00:04\n",
      "     -----------------------------            10.6/14.5 MB 1.3 MB/s eta 0:00:04\n",
      "     -----------------------------            10.7/14.5 MB 1.3 MB/s eta 0:00:03\n",
      "     -----------------------------            10.9/14.5 MB 1.3 MB/s eta 0:00:03\n",
      "     ------------------------------           11.0/14.5 MB 1.3 MB/s eta 0:00:03\n",
      "     ------------------------------           11.1/14.5 MB 1.3 MB/s eta 0:00:03\n",
      "     -------------------------------          11.3/14.5 MB 1.3 MB/s eta 0:00:03\n",
      "     -------------------------------          11.3/14.5 MB 1.3 MB/s eta 0:00:03\n",
      "     -------------------------------          11.3/14.5 MB 1.3 MB/s eta 0:00:03\n",
      "     -------------------------------          11.4/14.5 MB 1.3 MB/s eta 0:00:03\n",
      "     -------------------------------          11.5/14.5 MB 1.3 MB/s eta 0:00:03\n",
      "     -------------------------------          11.6/14.5 MB 1.3 MB/s eta 0:00:03\n",
      "     -------------------------------          11.6/14.5 MB 1.3 MB/s eta 0:00:03\n",
      "     --------------------------------         11.7/14.5 MB 1.3 MB/s eta 0:00:03\n",
      "     --------------------------------         11.7/14.5 MB 1.3 MB/s eta 0:00:03\n",
      "     --------------------------------         11.8/14.5 MB 1.3 MB/s eta 0:00:03\n",
      "     --------------------------------         11.9/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     --------------------------------         11.9/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     --------------------------------         11.9/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     ---------------------------------        12.0/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     ---------------------------------        12.0/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     ---------------------------------        12.1/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     ---------------------------------        12.2/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     ---------------------------------        12.3/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     ----------------------------------       12.4/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     ----------------------------------       12.5/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     ----------------------------------       12.5/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     ----------------------------------       12.5/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     ----------------------------------       12.5/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     ----------------------------------       12.6/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     ----------------------------------       12.6/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     ----------------------------------       12.7/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     -----------------------------------      12.8/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     -----------------------------------      12.8/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     -----------------------------------      12.9/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     ------------------------------------     13.1/14.5 MB 1.3 MB/s eta 0:00:02\n",
      "     ------------------------------------     13.3/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     ------------------------------------     13.4/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     ------------------------------------     13.4/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     ------------------------------------     13.4/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     ------------------------------------     13.4/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     ------------------------------------     13.4/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     -------------------------------------    13.5/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     -------------------------------------    13.5/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     -------------------------------------    13.6/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     -------------------------------------    13.8/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     --------------------------------------   13.8/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     --------------------------------------   13.8/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     --------------------------------------   13.8/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     --------------------------------------   13.9/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     --------------------------------------   13.9/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     --------------------------------------   14.0/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     --------------------------------------   14.1/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     --------------------------------------   14.2/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     ---------------------------------------  14.2/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     ---------------------------------------  14.3/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     ---------------------------------------  14.4/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     ---------------------------------------  14.5/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     ---------------------------------------  14.5/14.5 MB 1.3 MB/s eta 0:00:01\n",
      "     ---------------------------------------- 14.5/14.5 MB 1.3 MB/s eta 0:00:00\n",
      "Requirement already satisfied: onnxruntime<2.0.0,>=1.17.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from fastembed==0.3.6->qdrant-client[fastembed]) (1.18.1)\n",
      "Requirement already satisfied: pillow<11.0.0,>=10.3.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from fastembed==0.3.6->qdrant-client[fastembed]) (10.4.0)\n",
      "Requirement already satisfied: requests<3.0,>=2.31 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from fastembed==0.3.6->qdrant-client[fastembed]) (2.32.3)\n",
      "Collecting snowballstemmer<3.0.0,>=2.2.0 (from fastembed==0.3.6->qdrant-client[fastembed])\n",
      "  Downloading snowballstemmer-2.2.0-py2.py3-none-any.whl (93 kB)\n",
      "                                              0.0/93.0 kB ? eta -:--:--\n",
      "     ------------------------------           71.7/93.0 kB 3.8 MB/s eta 0:00:01\n",
      "     ---------------------------------------- 93.0/93.0 kB 1.3 MB/s eta 0:00:00\n",
      "Requirement already satisfied: tokenizers<1.0,>=0.15 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from fastembed==0.3.6->qdrant-client[fastembed]) (0.19.1)\n",
      "Requirement already satisfied: tqdm<5.0,>=4.66 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from fastembed==0.3.6->qdrant-client[fastembed]) (4.67.1)\n",
      "Requirement already satisfied: protobuf<5.0dev,>=4.21.6 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from grpcio-tools>=1.41.0->qdrant-client[fastembed]) (4.25.5)\n",
      "Requirement already satisfied: setuptools in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from grpcio-tools>=1.41.0->qdrant-client[fastembed]) (67.8.0)\n",
      "Requirement already satisfied: anyio in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from httpx[http2]>=0.20.0->qdrant-client[fastembed]) (4.4.0)\n",
      "Requirement already satisfied: certifi in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from httpx[http2]>=0.20.0->qdrant-client[fastembed]) (2024.7.4)\n",
      "Requirement already satisfied: httpcore==1.* in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from httpx[http2]>=0.20.0->qdrant-client[fastembed]) (1.0.5)\n",
      "Requirement already satisfied: idna in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from httpx[http2]>=0.20.0->qdrant-client[fastembed]) (3.4)\n",
      "Requirement already satisfied: h2<5,>=3 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from httpx[http2]>=0.20.0->qdrant-client[fastembed]) (4.1.0)\n",
      "Requirement already satisfied: h11<0.15,>=0.13 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from httpcore==1.*->httpx[http2]>=0.20.0->qdrant-client[fastembed]) (0.14.0)\n",
      "Requirement already satisfied: pywin32>=226 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from portalocker<3.0.0,>=2.7.0->qdrant-client[fastembed]) (305.1)\n",
      "Requirement already satisfied: annotated-types>=0.4.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from pydantic>=1.10.8->qdrant-client[fastembed]) (0.7.0)\n",
      "Requirement already satisfied: pydantic-core==2.20.1 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from pydantic>=1.10.8->qdrant-client[fastembed]) (2.20.1)\n",
      "Requirement already satisfied: typing-extensions>=4.6.1 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from pydantic>=1.10.8->qdrant-client[fastembed]) (4.12.2)\n",
      "Requirement already satisfied: hyperframe<7,>=6.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from h2<5,>=3->httpx[http2]>=0.20.0->qdrant-client[fastembed]) (6.0.1)\n",
      "Requirement already satisfied: hpack<5,>=4.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from h2<5,>=3->httpx[http2]>=0.20.0->qdrant-client[fastembed]) (4.0.0)\n",
      "Requirement already satisfied: filelock in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from huggingface-hub<1.0,>=0.20->fastembed==0.3.6->qdrant-client[fastembed]) (3.15.4)\n",
      "Requirement already satisfied: fsspec>=2023.5.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from huggingface-hub<1.0,>=0.20->fastembed==0.3.6->qdrant-client[fastembed]) (2024.6.1)\n",
      "Requirement already satisfied: packaging>=20.9 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from huggingface-hub<1.0,>=0.20->fastembed==0.3.6->qdrant-client[fastembed]) (24.1)\n",
      "Requirement already satisfied: pyyaml>=5.1 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from huggingface-hub<1.0,>=0.20->fastembed==0.3.6->qdrant-client[fastembed]) (6.0.1)\n",
      "Requirement already satisfied: colorama>=0.3.4 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from loguru<0.8.0,>=0.7.2->fastembed==0.3.6->qdrant-client[fastembed]) (0.4.6)\n",
      "Collecting win32-setctime>=1.0.0 (from loguru<0.8.0,>=0.7.2->fastembed==0.3.6->qdrant-client[fastembed])\n",
      "  Downloading win32_setctime-1.2.0-py3-none-any.whl (4.1 kB)\n",
      "Requirement already satisfied: coloredlogs in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from onnxruntime<2.0.0,>=1.17.0->fastembed==0.3.6->qdrant-client[fastembed]) (15.0.1)\n",
      "Requirement already satisfied: flatbuffers in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from onnxruntime<2.0.0,>=1.17.0->fastembed==0.3.6->qdrant-client[fastembed]) (24.3.25)\n",
      "Requirement already satisfied: sympy in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from onnxruntime<2.0.0,>=1.17.0->fastembed==0.3.6->qdrant-client[fastembed]) (1.13.1)\n",
      "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from requests<3.0,>=2.31->fastembed==0.3.6->qdrant-client[fastembed]) (2.0.4)\n",
      "Requirement already satisfied: sniffio>=1.1 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from anyio->httpx[http2]>=0.20.0->qdrant-client[fastembed]) (1.3.1)\n",
      "Requirement already satisfied: humanfriendly>=9.1 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from coloredlogs->onnxruntime<2.0.0,>=1.17.0->fastembed==0.3.6->qdrant-client[fastembed]) (10.0)\n",
      "Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from sympy->onnxruntime<2.0.0,>=1.17.0->fastembed==0.3.6->qdrant-client[fastembed]) (1.3.0)\n",
      "Requirement already satisfied: pyreadline3 in c:\\users\\shrey\\miniconda3\\envs\\futuresmart\\lib\\site-packages (from humanfriendly>=9.1->coloredlogs->onnxruntime<2.0.0,>=1.17.0->fastembed==0.3.6->qdrant-client[fastembed]) (3.4.1)\n",
      "Installing collected packages: snowballstemmer, PyStemmer, win32-setctime, onnx, loguru, fastembed\n",
      "Successfully installed PyStemmer-2.2.0.3 fastembed-0.3.6 loguru-0.7.3 onnx-1.17.0 snowballstemmer-2.2.0 win32-setctime-1.2.0\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "!pip install qdrant-client[fastembed]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "from qdrant_client import QdrantClient, models\n",
    "qdrant = QdrantClient(\"http://localhost:6333\", api_key=\"123456\") # Connect to existing Qdrant instance\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "from qdrant_client import QdrantClient, models\n",
    "# Initialize the client\n",
    "client = QdrantClient(path=\"local mode/\") # QdrantClient(\":memory:\") \n",
    "# client.query"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "\n",
    "def read_files_from_folder(folder_path):\n",
    "    file_data = []\n",
    "\n",
    "    for file_name in os.listdir(folder_path):\n",
    "        if file_name.endswith(\".json\"):\n",
    "            with open(os.path.join(folder_path, file_name), 'r') as file:\n",
    "                # content = file.read()\n",
    "                content = json.load(file)\n",
    "                file_data.append({\"file_name\": file_name, \"content\": content})\n",
    "\n",
    "    return file_data\n",
    "\n",
    "folder_path = \"data\"\n",
    "file_data = read_files_from_folder(folder_path)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "documents = []\n",
    "metadatas = []\n",
    "ids = []\n",
    "\n",
    "import uuid \n",
    "\n",
    "for file_index, data in enumerate(file_data):\n",
    "    context = data[\"content\"]\n",
    "    documents.extend(movie[\"description\"] for movie in context)\n",
    "    metadatas.extend(\n",
    "        {**{key: value for key, value in movie.items() if key != \"description\"}, \"source\": data[\"file_name\"]}\n",
    "        for movie in context\n",
    "    )\n",
    "    ids.extend(str(uuid.uuid4()) for _ in context)  # Generate a unique UUID for each movie"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(['Two ex-convicts are hired by a retired policeman to capture a ruthless dacoit terrorizing a village.',\n",
       "  'Villagers unite to play a cricket match against British officers to abolish oppressive taxes.',\n",
       "  'A prince falls in love with a court dancer, leading to a tragic conflict with his father, the emperor.',\n",
       "  'A former wrestler trains his daughters to become world-class wrestlers against societal odds.',\n",
       "  'A young couple falls in love during a trip to Europe but must overcome familial objections.',\n",
       "  'Three engineering students navigate the pressures of academia while challenging societal norms.',\n",
       "  'The heartwarming tale of a mute and deaf man and his relationships with two women.',\n",
       "  'A young man from the slums of Mumbai rises to fame as a rapper, inspired by his challenging life.',\n",
       "  'A poor villager struggles to raise her sons and fight against exploitation while maintaining her moral integrity.',\n",
       "  'A dyslexic boy discovers his artistic talent with the help of a compassionate teacher.',\n",
       "  'A blind pianist becomes entangled in a murder mystery with unexpected twists.',\n",
       "  'A struggling poet seeks recognition for his work while exploring themes of love and societal rejection.',\n",
       "  'A man becomes a reluctant hero when his village faces an existential crisis involving tradition and greed.'],\n",
       " [{'name': 'Sholay',\n",
       "   'description': 'Two ex-convicts are hired by a retired policeman to capture a ruthless dacoit terrorizing a village.',\n",
       "   'director': 'Ramesh Sippy',\n",
       "   'year': 1975,\n",
       "   'source': 'movies.json'},\n",
       "  {'name': 'Lagaan',\n",
       "   'description': 'Villagers unite to play a cricket match against British officers to abolish oppressive taxes.',\n",
       "   'director': 'Ashutosh Gowariker',\n",
       "   'year': 2001,\n",
       "   'source': 'movies.json'},\n",
       "  {'name': 'Mughal-e-Azam',\n",
       "   'description': 'A prince falls in love with a court dancer, leading to a tragic conflict with his father, the emperor.',\n",
       "   'director': 'K. Asif',\n",
       "   'year': 1960,\n",
       "   'source': 'movies.json'},\n",
       "  {'name': 'Dangal',\n",
       "   'description': 'A former wrestler trains his daughters to become world-class wrestlers against societal odds.',\n",
       "   'director': 'Nitesh Tiwari',\n",
       "   'year': 2016,\n",
       "   'source': 'movies.json'},\n",
       "  {'name': 'Dilwale Dulhania Le Jayenge',\n",
       "   'description': 'A young couple falls in love during a trip to Europe but must overcome familial objections.',\n",
       "   'director': 'Aditya Chopra',\n",
       "   'year': 1995,\n",
       "   'source': 'movies.json'},\n",
       "  {'name': '3 Idiots',\n",
       "   'description': 'Three engineering students navigate the pressures of academia while challenging societal norms.',\n",
       "   'director': 'Rajkumar Hirani',\n",
       "   'year': 2009,\n",
       "   'source': 'movies.json'},\n",
       "  {'name': 'Barfi!',\n",
       "   'description': 'The heartwarming tale of a mute and deaf man and his relationships with two women.',\n",
       "   'director': 'Anurag Basu',\n",
       "   'year': 2012,\n",
       "   'source': 'movies.json'},\n",
       "  {'name': 'Gully Boy',\n",
       "   'description': 'A young man from the slums of Mumbai rises to fame as a rapper, inspired by his challenging life.',\n",
       "   'director': 'Zoya Akhtar',\n",
       "   'year': 2019,\n",
       "   'source': 'movies.json'},\n",
       "  {'name': 'Mother India',\n",
       "   'description': 'A poor villager struggles to raise her sons and fight against exploitation while maintaining her moral integrity.',\n",
       "   'director': 'Mehboob Khan',\n",
       "   'year': 1957,\n",
       "   'source': 'movies.json'},\n",
       "  {'name': 'Taare Zameen Par',\n",
       "   'description': 'A dyslexic boy discovers his artistic talent with the help of a compassionate teacher.',\n",
       "   'director': 'Aamir Khan',\n",
       "   'year': 2007,\n",
       "   'source': 'movies.json'},\n",
       "  {'name': 'Andhadhun',\n",
       "   'description': 'A blind pianist becomes entangled in a murder mystery with unexpected twists.',\n",
       "   'director': 'Sriram Raghavan',\n",
       "   'year': 2018,\n",
       "   'source': 'movies.json'},\n",
       "  {'name': 'Pyaasa',\n",
       "   'description': 'A struggling poet seeks recognition for his work while exploring themes of love and societal rejection.',\n",
       "   'director': 'Guru Dutt',\n",
       "   'year': 1957,\n",
       "   'source': 'movies.json'},\n",
       "  {'name': 'Kantara',\n",
       "   'description': 'A man becomes a reluctant hero when his village faces an existential crisis involving tradition and greed.',\n",
       "   'director': 'Rishab Shetty',\n",
       "   'year': 2022,\n",
       "   'source': 'movies.json'}],\n",
       " ['7aa5f6f5-5de5-4776-8090-9a7c38a4cfcf',\n",
       "  'ec1cf50b-611d-4d84-8b60-20a3fd9a1a67',\n",
       "  '895fdafc-2801-4b73-a954-e1c6d6bac0b4',\n",
       "  '0d8c2ef2-54a2-4ffb-add2-3dc60f106920',\n",
       "  'abac1eb1-7e36-450d-9da8-834c06dae677',\n",
       "  'b5f94cb2-77d0-418d-85c9-7e5f2c0c4c61',\n",
       "  'cd1fe5c9-f77c-4c21-882d-26ad29b56d20',\n",
       "  '67160882-7fe0-4e87-8ef4-f49df4e17676',\n",
       "  '932600a5-de01-4211-91bf-734813e5e9a1',\n",
       "  '0383c89e-5ad0-4f12-8a70-a1695e30c228',\n",
       "  'c65a32ac-0dc3-4821-a164-a95b7a4ba244',\n",
       "  '96c7a287-ded4-403b-8607-891bb361e70f',\n",
       "  'db38fd28-0825-43a5-9f23-003007ce5859'])"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "documents, metadatas, ids"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['3c518bae14b743aaac3775d8ef7c89c5',\n",
       " '0ebb2c74991e41e7b751953891b5903b',\n",
       " 'e561c4d969114de18671fb246c2de592',\n",
       " '676575e34820472daf0d29a37e8dc240',\n",
       " '9fd3f3597d384ae9b38c7e5fbbfb73cf',\n",
       " 'f4a6a7df8009491f9094c71f235e3a53',\n",
       " 'a4348d92917a429288d02ab9acd768d8',\n",
       " '605d1b95588340f8b1f3ed43bb226459',\n",
       " 'bcffa10171114ffaa43034085884ec4e',\n",
       " '3e9a81580ea44bf4ac94ed92a609b0d0',\n",
       " '7300532412b343f6a80787dbb5a66dde',\n",
       " '41ae37bb0a1a4738944a56fa67b962af',\n",
       " 'b96d0221cee24ef68367b33416fd55fd']"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Use the new add method\n",
    "client.add(\n",
    "    collection_name=\"new_movie_collection3\",\n",
    "    documents = documents,\n",
    "    metadata = metadatas\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[QueryResponse(id='96d0e002-bc96-47a5-9307-16e0924ff9f6', embedding=[-0.014765951, 0.030632226, 0.005360677, 0.0064872988, -0.028201811, 0.002933693, 0.060042385, -0.010932039, -0.007191596, -0.029050753, -0.007425845, -0.0466413, 0.03886968, 0.0030478127, 0.07747522, 0.045019645, 0.017941456, 0.018619113, -0.08843627, 0.0348742, 0.044461023, -0.0037572517, -0.042706776, -0.039381083, 0.0021316726, 0.0047257454, -0.022171667, -0.011633967, -0.03526109, -0.11037699, -0.048250355, -0.01090897, 0.026375694, -0.018359082, 0.037242975, -0.053647365, -0.0064534615, 0.012276925, 0.003963983, 0.027977036, -0.011605849, -0.032270174, 0.033452835, -0.06294632, -0.007157293, -0.020678172, -0.022877825, -0.0145705165, 0.05825636, -0.09596776, -0.048163295, -0.055122793, -0.012612943, 0.026080042, 0.011777966, 0.04158661, 0.083243914, 0.05719242, -0.017609155, 0.006865046, 0.00044649641, 0.01129776, -0.12997271, 0.05810518, 0.050371416, -0.007171868, -0.023887824, -0.06080389, 0.008947729, -0.004211557, -0.029769244, 0.0021369117, 0.01682913, -0.010195419, 0.029030925, 0.011359087, -0.031137051, -0.061462913, -0.003509056, 0.030546289, -0.017981896, 0.008174488, -0.013778572, -0.012828765, -0.030834243, -0.015574325, 0.04451016, -0.06363778, -0.033807494, -0.008995057, -0.048325688, 0.009133904, -0.020714438, 0.017431188, -0.03132867, -0.035027683, -0.0037336217, 0.0054357573, -0.051315226, 0.5402948, 0.03299606, -0.031306986, 0.050488845, -0.011671684, 0.01469775, 0.017686548, -0.024311582, -0.05098532, 0.013857091, -0.0008258979, 0.029296074, -0.036615998, 0.060925573, -0.015199534, 0.020721463, 0.0698508, 0.03740845, 0.007661647, 0.03422648, -0.0014856269, -0.007867288, 0.009446217, 0.0034338362, -0.03424819, 0.031526696, -0.039883144, 0.082529366, 0.0968809, 0.038742296, 0.0011297953, 0.04035263, 0.0020616197, -0.0028718885, 0.0075388798, -0.02019144, -0.017281897, -0.06241604, 0.029992197, 0.05020737, -0.030283073, 0.021785391, -0.13005334, -0.050766904, -0.04678752, 0.01075851, 0.06330464, 0.0073691877, -0.016305529, -0.023080627, 0.087122485, -0.004281119, -0.024200473, -0.0096072685, 0.0020671294, 0.01734093, -0.0030268212, 0.031181116, 0.024350632, -0.04471516, 0.076183945, -0.004010043, -0.018753933, -0.027977176, -0.040787067, 0.020799039, -0.067073405, -0.04244377, -0.00508479, 0.03202146, -0.03727833, 0.02263132, -0.009759829, -0.013294848, 0.017368453, 0.018800544, 0.035374474, 0.004171457, 0.012395045, -0.028578699, -0.006574716, -0.026402693, -0.0020255474, -0.062151976, 0.01294543, 0.025187839, -0.018410573, 0.026945109, -0.033732805, 0.02626106, 0.04536076, 0.06912313, 0.033501636, -0.00551212, 0.0073019057, -0.03831193, -0.017636392, -0.01512137, -0.035011493, -0.06698683, 0.014098797, -0.018773338, -0.026048273, -0.023978949, 0.037841953, 0.05357661, 0.011051825, -0.012171052, -0.0634179, 0.022605436, 0.06833435, -0.022637429, 0.013042296, 0.029580709, 0.0027300369, -0.014473529, 0.008858073, 0.031054432, 0.06060387, -0.0210404, 0.05115776, 0.027429277, -0.061937384, -0.0667064, -0.261751, 0.0086129075, 0.000679225, -0.024040045, 0.004615412, 0.0029190662, 0.028142378, -0.015033392, 0.05222503, 0.050921984, 0.046053063, 0.011014482, -0.017051697, 0.03509429, -0.0142867565, -0.0048614107, -0.025179215, 0.038641136, -0.02727247, 0.0026374906, 0.0065629603, 0.008831382, 0.00041274462, -0.034246266, 0.05549361, -0.02248713, 0.19280045, 0.043771632, -0.007908591, -0.025153836, -0.014041287, 0.0065617394, -0.04283307, -0.08175749, 0.032181043, 0.064374015, 0.04993888, -0.02680943, -0.011945522, -0.0043710493, -0.0180764, -0.00604858, -0.0043133176, -0.012966889, -0.05363002, -0.052269015, 0.013276999, 4.968573e-05, 0.0040260553, 0.0050733443, 0.010012846, -0.010309459, 0.036763594, 0.037778717, -0.016646434, -0.008780611, -0.0323617, 0.048649006, -0.01692138, 0.05496167, 0.0219692, -0.023400746, 0.014589556, -0.02627129, 0.011619066, 0.006630314, -0.03247574, 0.033504672, -0.019119862, -0.02704869, -0.02796049, -0.012298078, 0.0061466577, -0.067386605, 0.030808521, 0.03208175, 0.005903009, -0.07633812, -0.02995445, -0.045580942, 0.02562037, -0.0023861148, -0.002105425, -0.004815967, 0.008363336, -0.010172742, 0.01564187, 0.0287272, 0.0027300473, -0.031427212, -0.0036892276, 0.022765713, -0.035803296, -0.0620463, -7.782215e-05, 0.010483044, -0.30657113, -0.03353394, -0.06276615, -0.014439009, -0.04347726, 0.018607834, -0.031187447, 0.027824953, -0.076558985, -0.004868491, 0.05154857, 0.0012432956, 0.010251227, -0.0032133672, 0.015138849, 0.07947284, 0.065547094, 0.012285389, 0.0021405194, -0.05481206, -0.02695481, 0.023191024, 0.18033843, 0.0065758484, 0.01853852, 0.0038359843, 0.042381868, 0.013548289, -0.03305049, -0.031153662, -0.008315769, 0.031110337, 0.0668093, -0.014927244, 0.006925857, 0.03862123, 0.012951838, 0.031156847, 0.07256495, 0.023498071, 0.017114032, 0.02595586, -0.0004535369, -0.056094017, 0.04999674, -0.007620854, -0.011263174, 0.00073437294, 0.03790999, 0.01852688, -0.024488317, 0.033643194, 0.029199144, 0.045364786, -0.008675847, 0.0040549184, -0.010599769, -0.0029247908, -0.004857425, -0.043024983, -0.010597761, -0.024229527, -0.014654592, -0.010793917, 0.024735136], sparse_embedding=None, metadata={'document': 'The heartwarming tale of a mute and deaf man and his relationships with two women.', 'name': 'Barfi!', 'director': 'Anurag Basu', 'year': 2012}, document='The heartwarming tale of a mute and deaf man and his relationships with two women.', score=0.76938045)]\n"
     ]
    }
   ],
   "source": [
    "search_result = qdrant.query(\n",
    "    collection_name=\"movie_collection\",\n",
    "    query_text=\"for adults\",\n",
    "    with_vectors=True,\n",
    "    limit = 1\n",
    ")\n",
    "print(search_result)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[QueryResponse(id='cac64ed7b15243488397ed886df2b7cc', embedding=None, sparse_embedding=None, metadata={'document': 'A dyslexic boy discovers his artistic talent with the help of a compassionate teacher.', 'name': 'Taare Zameen Par', 'director': 'Aamir Khan', 'year': 2007}, document='A dyslexic boy discovers his artistic talent with the help of a compassionate teacher.', score=0.7819896228766485)]\n"
     ]
    }
   ],
   "source": [
    "search_result = client.query(\n",
    "    collection_name=\"movie_collection\",\n",
    "    query_text=\"for children\",\n",
    "    limit = 1\n",
    ")\n",
    "print(search_result)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "c:\\Users\\shrey\\miniconda3\\envs\\futuresmart\\Lib\\site-packages\\transformers\\tokenization_utils_base.py:1601: FutureWarning: `clean_up_tokenization_spaces` was not set. It will be set to `True` by default. This behavior will be depracted in transformers v4.45, and will be then set to `False` by default. For more details check this issue: https://github.com/huggingface/transformers/issues/31884\n",
      "  warnings.warn(\n"
     ]
    }
   ],
   "source": [
    "from sentence_transformers import SentenceTransformer\n",
    "\n",
    "encoder = SentenceTransformer(\"all-MiniLM-L6-v2\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "qdrant.create_collection(\n",
    "    collection_name=\"my_movies_new\",\n",
    "    vectors_config=models.VectorParams(\n",
    "        size=encoder.get_sentence_embedding_dimension(),  # Vector size is defined by used model\n",
    "        distance=models.Distance.COSINE,\n",
    "    ),\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [],
   "source": [
    "documents = []\n",
    "metadatas = []\n",
    "ids = []\n",
    "\n",
    "import uuid \n",
    "\n",
    "for file_index, data in enumerate(file_data):\n",
    "    context = data[\"content\"]\n",
    "    documents.extend(movie[\"description\"] for movie in context)\n",
    "    metadatas.extend(\n",
    "        {**{key: value for key, value in movie.items() }, \"source\": data[\"file_name\"]}\n",
    "        for movie in context\n",
    "    )\n",
    "    ids.extend(str(uuid.uuid4()) for _ in context)  # Generate a unique UUID for each movie"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'name': 'Sholay',\n",
       "  'description': 'Two ex-convicts are hired by a retired policeman to capture a ruthless dacoit terrorizing a village.',\n",
       "  'director': 'Ramesh Sippy',\n",
       "  'year': 1975,\n",
       "  'source': 'movies.json'},\n",
       " {'name': 'Lagaan',\n",
       "  'description': 'Villagers unite to play a cricket match against British officers to abolish oppressive taxes.',\n",
       "  'director': 'Ashutosh Gowariker',\n",
       "  'year': 2001,\n",
       "  'source': 'movies.json'},\n",
       " {'name': 'Mughal-e-Azam',\n",
       "  'description': 'A prince falls in love with a court dancer, leading to a tragic conflict with his father, the emperor.',\n",
       "  'director': 'K. Asif',\n",
       "  'year': 1960,\n",
       "  'source': 'movies.json'},\n",
       " {'name': 'Dangal',\n",
       "  'description': 'A former wrestler trains his daughters to become world-class wrestlers against societal odds.',\n",
       "  'director': 'Nitesh Tiwari',\n",
       "  'year': 2016,\n",
       "  'source': 'movies.json'},\n",
       " {'name': 'Dilwale Dulhania Le Jayenge',\n",
       "  'description': 'A young couple falls in love during a trip to Europe but must overcome familial objections.',\n",
       "  'director': 'Aditya Chopra',\n",
       "  'year': 1995,\n",
       "  'source': 'movies.json'},\n",
       " {'name': '3 Idiots',\n",
       "  'description': 'Three engineering students navigate the pressures of academia while challenging societal norms.',\n",
       "  'director': 'Rajkumar Hirani',\n",
       "  'year': 2009,\n",
       "  'source': 'movies.json'},\n",
       " {'name': 'Barfi!',\n",
       "  'description': 'The heartwarming tale of a mute and deaf man and his relationships with two women.',\n",
       "  'director': 'Anurag Basu',\n",
       "  'year': 2012,\n",
       "  'source': 'movies.json'},\n",
       " {'name': 'Gully Boy',\n",
       "  'description': 'A young man from the slums of Mumbai rises to fame as a rapper, inspired by his challenging life.',\n",
       "  'director': 'Zoya Akhtar',\n",
       "  'year': 2019,\n",
       "  'source': 'movies.json'},\n",
       " {'name': 'Mother India',\n",
       "  'description': 'A poor villager struggles to raise her sons and fight against exploitation while maintaining her moral integrity.',\n",
       "  'director': 'Mehboob Khan',\n",
       "  'year': 1957,\n",
       "  'source': 'movies.json'},\n",
       " {'name': 'Taare Zameen Par',\n",
       "  'description': 'A dyslexic boy discovers his artistic talent with the help of a compassionate teacher.',\n",
       "  'director': 'Aamir Khan',\n",
       "  'year': 2007,\n",
       "  'source': 'movies.json'},\n",
       " {'name': 'Andhadhun',\n",
       "  'description': 'A blind pianist becomes entangled in a murder mystery with unexpected twists.',\n",
       "  'director': 'Sriram Raghavan',\n",
       "  'year': 2018,\n",
       "  'source': 'movies.json'},\n",
       " {'name': 'Pyaasa',\n",
       "  'description': 'A struggling poet seeks recognition for his work while exploring themes of love and societal rejection.',\n",
       "  'director': 'Guru Dutt',\n",
       "  'year': 1957,\n",
       "  'source': 'movies.json'},\n",
       " {'name': 'Kantara',\n",
       "  'description': 'A man becomes a reluctant hero when his village faces an existential crisis involving tradition and greed.',\n",
       "  'director': 'Rishab Shetty',\n",
       "  'year': 2022,\n",
       "  'source': 'movies.json'}]"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "metadatas"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [],
   "source": [
    "qdrant.upload_points(\n",
    "    collection_name=\"my_movies_new\",\n",
    "    points=[\n",
    "        models.PointStruct(\n",
    "            id=idx, vector=encoder.encode(doc[\"description\"]).tolist(), payload=doc\n",
    "        )\n",
    "        for idx, doc in enumerate(metadatas)\n",
    "    ],\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [],
   "source": [
    "from qdrant_client import QdrantClient, models\n",
    "qdrant = QdrantClient(\"http://localhost:6333\", api_key=\"123456\") # Connect to existing Qdrant instance\n",
    "\n",
    "qdrant.upload_collection(\n",
    "    collection_name=\"my_movies_new\",\n",
    "    ids=ids,\n",
    "    vectors=encoder.encode(documents),\n",
    "    payload=metadatas\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'name': '3 Idiots', 'director': 'Rajkumar Hirani', 'year': 2009, 'source': 'movies.json'} score: 0.6074455\n",
      "{'name': '3 Idiots', 'description': 'Three engineering students navigate the pressures of academia while challenging societal norms.', 'director': 'Rajkumar Hirani', 'year': 2009, 'source': 'movies.json'} score: 0.6074454\n",
      "{'name': 'Dangal', 'description': 'A former wrestler trains his daughters to become world-class wrestlers against societal odds.', 'director': 'Nitesh Tiwari', 'year': 2016, 'source': 'movies.json'} score: 0.23663726\n"
     ]
    }
   ],
   "source": [
    "from qdrant_client.models import Filter, FieldCondition, MatchValue\n",
    "\n",
    "hits = qdrant.query_points(\n",
    "    collection_name=\"my_movies_new\",\n",
    "    query=encoder.encode(\"engineering student life\").tolist(),\n",
    "    limit=3,\n",
    "    with_payload=True,\n",
    "    query_filter=Filter(\n",
    "        should=[FieldCondition(\n",
    "            key=\"year\",\n",
    "            range=models.Range(\n",
    "            gt=None,\n",
    "            gte=2005,\n",
    "            lt=None,\n",
    "            lte=None,),\n",
    "        )]\n",
    "    ),\n",
    ").points\n",
    "\n",
    "for hit in hits:\n",
    "    print(hit.payload, \"score:\", hit.score)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[ScoredPoint(id='5a4913ba-17a9-490e-83f6-a4222ba0c124', version=0, score=0.6074455, payload={'name': '3 Idiots', 'director': 'Rajkumar Hirani', 'year': 2009, 'source': 'movies.json'}, vector=None, shard_key=None, order_value=None),\n",
       " ScoredPoint(id='8c7598f6-b10a-4283-94a0-65453b33fa99', version=0, score=0.2366372, payload={'name': 'Dangal', 'director': 'Nitesh Tiwari', 'year': 2016, 'source': 'movies.json'}, vector=None, shard_key=None, order_value=None),\n",
       " ScoredPoint(id='1cb2d485-7f7b-421c-9647-c6bd80255aaf', version=0, score=0.17959943, payload={'name': 'Taare Zameen Par', 'director': 'Aamir Khan', 'year': 2007, 'source': 'movies.json'}, vector=None, shard_key=None, order_value=None)]"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hits"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "{'name': '3 Idiots', 'description': 'Three engineering students navigate the pressures of academia while challenging societal norms.', 'director': 'Rajkumar Hirani', 'year': 2009} score: 0.43152368\n",
    "{'name': 'Taare Zameen Par', 'description': 'A dyslexic boy discovers his artistic talent with the help of a compassionate teacher.', 'director': 'Aamir Khan', 'year': 2007} score: 0.20039251\n",
    "{'name': 'Dangal', 'description': 'A former wrestler trains his daughters to become world-class wrestlers against societal odds.', 'director': 'Nitesh Tiwari', 'year': 2016} score: 0.19520974"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The embedding dimensionality is: 1536\n"
     ]
    }
   ],
   "source": [
    "import openai\n",
    "import os \n",
    "\n",
    "embedding_model = \"text-embedding-3-small\"\n",
    "\n",
    "openai_client = openai.Client(\n",
    "    api_key=\"<YOUR_API_KEY>\"\n",
    ")\n",
    "\n",
    "result = openai_client.embeddings.create(input=\"hey texts how are you?\", model=embedding_model)\n",
    "result\n",
    "\n",
    "# Extract the embedding vector\n",
    "embedding_vector = result.data[0].embedding\n",
    "\n",
    "# Determine the dimensionality\n",
    "embedding_dimension = len(embedding_vector)\n",
    "print(f\"The embedding dimensionality is: {embedding_dimension}\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "futuresmart",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
